<template>
    <div>
        <!-- <h1>rolelist 角色列表</h1> -->
        <BreadCrumb name1="权限管理" name2="权限列表"></BreadCrumb>
        <el-card class="card-box">
            <el-table border stripe class="el-table" :data="roleList" style="width:100%;">
                <el-table-column type="index" label="#">
                </el-table-column>
                <el-table-column prop="authName" label="权限说明"></el-table-column>
                <el-table-column prop="path" label="路径"></el-table-column>
                <el-table-column label="等级">
                    <template slot-scope="scoped">
                        <div>
                            <el-tag v-if="scoped.row.level == 0">一级</el-tag>
                            <el-tag v-else-if="scoped.row.level == 1" type="success">二级</el-tag>
                            <el-tag v-else type="danger">三级</el-tag>
                        </div>
                    </template>
                </el-table-column>

            </el-table>
        </el-card>
    </div>
</template>

<script>
import { role_list_req } from '@/api/role.js';
import BreadCrumb from '../../../components/breadcrumb/BreadCrumb.vue';
export default {
    components: {
        BreadCrumb
    },
    mounted() {
        this.getRoleList();
    },
    data() {
        return {
            roleList:[],
        };
    },
    methods: {
        async getRoleList() {
            const result = await role_list_req({
                method: 'get',
                url: 'rights/list',
            });
            console.log(result);
            if(result.meta.status !== 200) {
                return this.$message.console.error(('获取权限列表失败'));
            }
            this.roleList = result.data;
        },
    }
}
</script>

<style lang="scss" scoped>
.card-box {
    margin-top:'10px';
}
</style>